// noipNOi

#include <bits/stdc++.h>
using namespace std;

const int mod = 998244353;
const int MAXN = 2e5 + 5;
const int MAXM = 1e6 + 5;
int a[MAXN], n, D;
int cnt[MAXM];
int fac[MAXN];

int qpow(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1)
      res = 1ll * res * a % mod;
    a = 1ll * a * a % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  scanf("%d%d", &n, &D);
  for (int i = 1; i <= n; ++i)
    scanf("%d", a + i);
  sort(a + 1, a + n + 1);

  int p = 1; // 保证 a[p..i] >= a[i]-D
  int ans = 1;
  for (int i = 1; i <= n; ++i) {
    while (a[p] < a[i] - D)
      ++p;
    ans = 1ll * ans * (i - p + 1) % mod;
  }

  int down = 1;
  for (int i = 1; i <= n; ++i) {
    ++cnt[a[i]];
    down = 1ll * down * cnt[a[i]] % mod;
  }
  ans = 1ll * ans * qpow(down, mod - 2) % mod;
  printf("%d\n", ans);

  return 0;
}